package org.gongliang.jsmile.authc.sys.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.gongliang.jsmile.authc.sys.entity.SysUser;
import org.gongliang.jsmile.authc.sys.vo.SysUserVo;
import org.gongliang.jsmile.common.annotation.MybatisDao;
import org.gongliang.jsmile.common.base.BaseDao;

/**
* 
* @author 龚亮
* @version 1.0
* @date 2018年08月25日 04:57:24
*/
@MybatisDao
public interface SysUserDao extends BaseDao<SysUser> {

	@Update("UPDATE t_op_sys_user SET password=#{newPassword} WHERE id=#{userId} AND password=#{password}")
	Integer updatePassword(@Param("userId") Integer userId, @Param("password") String password,
			@Param("newPassword") String newPassword);

	@Select("SELECT a.*,b.dept_name deptName FROM t_op_sys_user a left join t_op_sys_department b on a.dept_id=b.id where user_name=#{username} limit 1")
	SysUserVo findUser(@Param("username") String username);

	public List<SysUserVo> findAllByVo(Map<String, Object> columnMap);
}
